package cn.hairui.blog.repository;

import cn.hairui.blog.mapper.AlbumMapper;
import cn.hairui.blog.model.Album;
import cn.hairui.blog.model.AlbumImg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author lihairui
 * @version V1.0
 * @date: 2019/7/5 22:08
 */
@Repository
public class AlbumRepository {

    @Autowired
    private AlbumMapper albumMapper;

    /*public List<Album> queryAlbumList() {
        return galleryMapper.queryAlbumList();
    }

    public int addAlbum(Album gallerys) {
        return galleryMapper.addAlbum(gallerys);
    }

    public int addAlbumImg(AlbumImg galleryImg) {
        return galleryMapper.addAlbumImg(galleryImg);
    }

    public Integer queryAlbumImgCountByAlbumId(Integer id) {
        return galleryMapper.queryAlbumImgCountByAlbumId(id);
    }

    public List<AlbumImg> queryAlbumImgByAlbumIdLimited(Integer id, Integer maxSize) {
        return galleryMapper.queryAlbumImgByAlbumIdLimited(id, maxSize);
    }

    public List<AlbumImg> queryAlbumImgList(Integer gallery_id) {
        return galleryMapper.queryAlbumImgList(gallery_id);
    }

    public Album queryAlbumById(Integer id) {
        return galleryMapper.queryAlbumById(id);
    }

    public int updateAlbum(Album gallerys) {
        return galleryMapper.updateAlbum(gallerys);
    }

    public AlbumImg queryAlbumImgById(Integer id) {
        return galleryMapper.queryAlbumImgById(id);
    }

    public AlbumImg queryAlbumImgByImgPathExceptId(Integer id, String imgPath) {
        return galleryMapper.queryAlbumImgByImgPathExceptId(id, imgPath);
    }

    public int deleteAlbumImgById(Integer id) {
        return galleryMapper.deleteAlbumImgById(id);
    }

    public AlbumImg queryAlbumImgByAlbumIdFirst(Integer galleryId) {
        return galleryMapper.queryAlbumImgByAlbumIdFirst(galleryId);
    }

    public int setShowImgByAlbumId(Integer galleryId, String newImg) {
        return galleryMapper.setShowImgByAlbumId(galleryId,newImg);
    }

    public int deleteAlbumById(Integer galleryId) {
        return galleryMapper.deleteAlbumById(galleryId);
    }

    public int queryAlbumImgByImgPath(String imgName) {
        return galleryMapper.queryAlbumImgByImgPath(imgName);
    }

    public List<Album> queryAlbumShowList() {
        return galleryMapper.queryAlbumShowList();
    }

    public List<Album> queryAlbumListByOwner(String username) {
        return galleryMapper.queryAlbumListByOwner(username);
    }

    public List<Album> queryAlbumListByOwnerAndShow(String username) {
        return galleryMapper.queryAlbumListByOwnerAndShow(username);
    }*/

    public AlbumImg findLatestImg() {
        return albumMapper.findLatestImg();
    }

    public List<Album> findGust() {
        return albumMapper.findGust();
    }

    public List<Album> findManager(String username) {
        return albumMapper.findManager(username);
    }

    public List<Album> list() {
        return albumMapper.list();
    }

    public Integer countImg(Integer id) {
        return albumMapper.countImg(id);
    }

    public Album find(int id) {
        return albumMapper.find(id);
    }

    public List<AlbumImg> findImgsByAlbuId(int id) {
        return albumMapper.findImgsByAlbuId(id);
    }

    public List<Map> listMgr() {
        return albumMapper.listMgr();
    }

    public void updateIsShow(int id, String flag) {
        albumMapper.updateIsShow(id, flag);
    }

    public List<Map> findImgsJsonByAlbuId(int id) {
        return albumMapper.findImgsJsonByAlbuId(id);
    }

    public void add(Album album) {
        albumMapper.insert(album);
    }

    public void deleteById(int id) {
        albumMapper.deleteById(id);
    }
}
